home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / util / misc / frodo.lha / src / FrodoPrefs.s < prev    next >
Text File  |  1995-01-25  |  18KB  |  812 lines

  1. *
  2. *  Source machine generated by GadToolsBox V2.0b
  3. *  which is (c) Copyright 1991-1993 Jaba Development
  4. *
  5. *  GUI Designed by : Christian Bauer
  6. *
  7.  
  8.     include 'exec/types.i'
  9.     include 'intuition/intuition.i'
  10.     include 'intuition/classes.i'
  11.     include 'intuition/classusr.i'
  12.     include 'intuition/imageclass.i'
  13.     include 'intuition/gadgetclass.i'
  14.     include 'libraries/gadtools.i'
  15.     include 'graphics/displayinfo.i'
  16.     include 'graphics/gfxbase.i'
  17.  
  18.     XREF    _GadToolsBase
  19.     XREF    _IntuitionBase
  20.     XREF    _GfxBase
  21.     XREF    _SysBase
  22.     XREF    _UtilityBase
  23.  
  24.     XREF    _LVOOpenScreenTagList
  25.     XREF    _LVOOpenWindowTagList
  26.     XREF    _LVOCloseScreen
  27.     XREF    _LVOCloseWindow
  28.     XREF    _LVOPrintIText
  29.     XREF    _LVOLockPubScreen
  30.     XREF    _LVOUnlockPubScreen
  31.     XREF    _LVOSetMenuStrip
  32.     XREF    _LVOClearMenuStrip
  33.     XREF    _LVOGetVisualInfoA
  34.     XREF    _LVOFreeVisualInfo
  35.     XREF    _LVOCreateContext
  36.     XREF    _LVOCreateGadgetA
  37.     XREF    _LVOGT_RefreshWindow
  38.     XREF    _LVOFreeGadgets
  39.     XREF    _LVOCreateMenusA
  40.     XREF    _LVOLayoutMenusA
  41.     XREF    _LVOFreeMenus
  42.     XREF    _LVOOpenDiskFont
  43.     XREF    _LVOCloseFont
  44.     XREF    _LVODrawBevelBoxA
  45.     XREF    _LVOFreeClass
  46.     XREF    _LVONewObjectA
  47.     XREF    _LVODisposeObject
  48.     XREF    _LVOTextLength
  49.     XREF    _LVOCopyMem
  50.     XREF    _LVOFindTagItem
  51.     XREF    _LVOIntuiTextLength
  52.     XREF    _LVOForbid
  53.     XREF    _LVOPermit
  54.  
  55. GD_OK                                  EQU    0
  56. GD_Cancel                              EQU    1
  57. GD_Save                                EQU    2
  58. GD_Joystick1On                         EQU    3
  59. GD_Joystick2On                         EQU    4
  60. GD_JoystickSwap                        EQU    5
  61. GD_GetDisplayID                        EQU    6
  62. GD_DisplayID                           EQU    7
  63. GD_ScreenType                          EQU    8
  64. GD_NormalCycles                        EQU    9
  65. GD_BadLineCycles                       EQU    10
  66. GD_CIACycles                           EQU    11
  67. GD_Dir8                                EQU    12
  68. GD_Dir9                                EQU    13
  69. GD_Dir10                               EQU    14
  70. GD_Dir11                               EQU    15
  71. GD_UseSIDCard                          EQU    16
  72. GD_Drv8IsIEC                           EQU    17
  73. GD_Drv9IsIEC                           EQU    18
  74. GD_Drv10IsIEC                          EQU    19
  75. GD_Drv11IsIEC                          EQU    20
  76. GD_GetDir8                             EQU    21
  77. GD_GetDir9                             EQU    22
  78. GD_GetDir10                            EQU    23
  79. GD_GetDir11                            EQU    24
  80. GD_OtherIEC                            EQU    25
  81. GD_KeyboardYZ                          EQU    26
  82.  
  83. Prefs_CNT    EQU    27
  84.  
  85.     XDEF    Scr
  86.     XDEF    VisualInfo
  87.     XDEF    PubScreenName
  88.     XDEF    PrefsWnd
  89.     XDEF    PrefsGList
  90.     XDEF    PrefsGadgets
  91.     XDEF    getClass
  92.     XDEF    getImage
  93.     XREF    initGet
  94.     XDEF    PrefsLeft
  95.     XDEF    PrefsTop
  96.     XDEF    PrefsWidth
  97.     XDEF    PrefsHeight
  98.     XDEF    Font
  99.     XDEF    Attr
  100.     XDEF    FontX
  101.     XDEF    FontY
  102.     XDEF    OffX
  103.     XDEF    OffY
  104.  
  105. Scr:
  106.     DC.L    0
  107. VisualInfo:
  108.     DC.L    0
  109. PubScreenName:
  110.     DC.L    WBName
  111. WBName:
  112.     DC.B    'Workbench',0
  113.     CNOP  0,2
  114. PrefsWnd:
  115.     DC.L    0
  116. PrefsGList:
  117.     DC.L    0
  118. PrefsGadgets:
  119.     DCB.L    27,0
  120. BufNewGad:
  121.     DC.W    0,0,0,0
  122.     DC.L    0,0
  123.     DC.W    0
  124.     DC.L    0,0,0
  125. TD:
  126.     DC.L    TAG_DONE
  127. getClass:
  128.     DC.L    0
  129. getImage:
  130.     DC.L    0
  131. CL:
  132.     DC.L    GT_VisualInfo,0,TAG_DONE
  133. PrefsLeft:
  134.     DC.W    0
  135. PrefsTop:
  136.     DC.W    11
  137. PrefsWidth:
  138.     DC.W    632
  139. PrefsHeight:
  140.     DC.W    197
  141. Font:
  142.     DC.L    0
  143. FontX:
  144.     DC.W    0
  145. FontY:
  146.     DC.W    0
  147. OffX:
  148.     DC.W    0
  149. OffY:
  150.     DC.W    0
  151. Attr:
  152.     DC.L    0
  153.     DC.W    0
  154.     DC.B    0,0
  155. TopazName:
  156.     DC.B    'topaz.font',0
  157.     CNOP    0,2
  158.  
  159. PrefsGTypes:
  160.     DC.W    BUTTON_KIND
  161.     DC.W    BUTTON_KIND
  162.     DC.W    BUTTON_KIND
  163.     DC.W    CHECKBOX_KIND
  164.     DC.W    CHECKBOX_KIND
  165.     DC.W    CHECKBOX_KIND
  166.     DC.W    BUTTON_KIND
  167.     DC.W    TEXT_KIND
  168.     DC.W    CYCLE_KIND
  169.     DC.W    INTEGER_KIND
  170.     DC.W    INTEGER_KIND
  171.     DC.W    INTEGER_KIND
  172.     DC.W    STRING_KIND
  173.     DC.W    STRING_KIND
  174.     DC.W    STRING_KIND
  175.     DC.W    STRING_KIND
  176.     DC.W    CHECKBOX_KIND
  177.     DC.W    CHECKBOX_KIND
  178.     DC.W    CHECKBOX_KIND
  179.     DC.W    CHECKBOX_KIND
  180.     DC.W    CHECKBOX_KIND
  181.     DC.W    GENERIC_KIND
  182.     DC.W    GENERIC_KIND
  183.     DC.W    GENERIC_KIND
  184.     DC.W    GENERIC_KIND
  185.     DC.W    CHECKBOX_KIND
  186.     DC.W    CHECKBOX_KIND
  187.  
  188. PrefsNGads:
  189.     DC.W    84,174,101,16
  190.     DC.L    OKText,0
  191.     DC.W    GD_OK
  192.     DC.L    PLACETEXT_IN,0,0
  193.     DC.W    443,174,101,16
  194.     DC.L    CancelText,0
  195.     DC.W    GD_Cancel
  196.     DC.L    PLACETEXT_IN,0,0
  197.     DC.W    263,174,101,16
  198.     DC.L    SaveText,0
  199.     DC.W    GD_Save
  200.     DC.L    PLACETEXT_IN,0,0
  201.     DC.W    188,56,26,11
  202.     DC.L    Joystick1OnText,0
  203.     DC.W    GD_Joystick1On
  204.     DC.L    PLACETEXT_LEFT,0,0
  205.     DC.W    188,69,26,11
  206.     DC.L    Joystick2OnText,0
  207.     DC.W    GD_Joystick2On
  208.     DC.L    PLACETEXT_LEFT,0,0
  209.     DC.W    188,82,26,11
  210.     DC.L    JoystickSwapText,0
  211.     DC.W    GD_JoystickSwap
  212.     DC.L    PLACETEXT_LEFT,0,0
  213.     DC.W    188,124,193,14
  214.     DC.L    GetDisplayIDText,0
  215.     DC.W    GD_GetDisplayID
  216.     DC.L    PLACETEXT_IN,0,0
  217.     DC.W    188,138,193,14
  218.     DC.L    DisplayIDText,0
  219.     DC.W    GD_DisplayID
  220.     DC.L    PLACETEXT_LEFT,0,0
  221.     DC.W    188,154,129,14
  222.     DC.L    ScreenTypeText,0
  223.     DC.W    GD_ScreenType
  224.     DC.L    PLACETEXT_LEFT,0,0
  225.     DC.W    188,7,81,14
  226.     DC.L    NormalCyclesText,0
  227.     DC.W    GD_NormalCycles
  228.     DC.L    PLACETEXT_LEFT,0,0
  229.     DC.W    188,23,81,14
  230.     DC.L    BadLineCyclesText,0
  231.     DC.W    GD_BadLineCycles
  232.     DC.L    PLACETEXT_LEFT,0,0
  233.     DC.W    188,39,81,14
  234.     DC.L    CIACyclesText,0
  235.     DC.W    GD_CIACycles
  236.     DC.L    PLACETEXT_LEFT,0,0
  237.     DC.W    377,19,193,14
  238.     DC.L    Dir8Text,0
  239.     DC.W    GD_Dir8
  240.     DC.L    PLACETEXT_LEFT,0,0
  241.     DC.W    377,35,193,14
  242.     DC.L    Dir9Text,0
  243.     DC.W    GD_Dir9
  244.     DC.L    PLACETEXT_LEFT,0,0
  245.     DC.W    377,51,193,14
  246.     DC.L    Dir10Text,0
  247.     DC.W    GD_Dir10
  248.     DC.L    PLACETEXT_LEFT,0,0
  249.     DC.W    377,67,193,14
  250.     DC.L    Dir11Text,0
  251.     DC.W    GD_Dir11
  252.     DC.L    PLACETEXT_LEFT,0,0
  253.     DC.W    188,96,26,11
  254.     DC.L    UseSIDCardText,0
  255.     DC.W    GD_UseSIDCard
  256.     DC.L    PLACETEXT_LEFT,0,0
  257.     DC.W    594,19,26,11
  258.     DC.L    Drv8IsIECText,0
  259.     DC.W    GD_Drv8IsIEC
  260.     DC.L    PLACETEXT_ABOVE,0,0
  261.     DC.W    594,35,26,11
  262.     DC.L    Drv9IsIECText,0
  263.     DC.W    GD_Drv9IsIEC
  264.     DC.L    0,0,0
  265.     DC.W    594,51,26,11
  266.     DC.L    Drv10IsIECText,0
  267.     DC.W    GD_Drv10IsIEC
  268.     DC.L    0,0,0
  269.     DC.W    594,67,26,11
  270.     DC.L    Drv11IsIECText,0
  271.     DC.W    GD_Drv11IsIEC
  272.     DC.L    0,0,0
  273.     DC.W    570,19,20,14
  274.     DC.L    GetDir8Text,0
  275.     DC.W    GD_GetDir8
  276.     DC.L    0,0,0
  277.     DC.W    570,35,20,14
  278.     DC.L    GetDir9Text,0
  279.     DC.W    GD_GetDir9
  280.     DC.L    0,0,0
  281.     DC.W    570,51,20,14
  282.     DC.L    GetDir10Text,0
  283.     DC.W    GD_GetDir10
  284.     DC.L    0,0,0
  285.     DC.W    570,67,20,14
  286.     DC.L    GetDir11Text,0
  287.     DC.W    GD_GetDir11
  288.     DC.L    0,0,0
  289.     DC.W    594,88,26,11
  290.     DC.L    OtherIECText,0
  291.     DC.W    GD_OtherIEC
  292.     DC.L    PLACETEXT_LEFT,0,0
  293.     DC.W    188,110,26,11
  294.     DC.L    KeyboardYZText,0
  295.     DC.W    GD_KeyboardYZ
  296.     DC.L    PLACETEXT_LEFT,0,0
  297.  
  298. PrefsGTags:
  299.     DC.L    GT_Underscore,'_'
  300.     DC.L    TAG_DONE
  301.     DC.L    GT_Underscore,'_'
  302.     DC.L    TAG_DONE
  303.     DC.L    GT_Underscore,'_'
  304.     DC.L    TAG_DONE
  305.     DC.L    TAG_DONE
  306.     DC.L    TAG_DONE
  307.     DC.L    TAG_DONE
  308.     DC.L    TAG_DONE
  309.     DC.L    GTTX_Border,1
  310.     DC.L    TAG_DONE
  311.     DC.L    GTCY_Labels,ScreenTypeLabels
  312.     DC.L    TAG_DONE
  313.     DC.L    GTIN_Number,0
  314.     DC.L    GTIN_MaxChars,10
  315.     DC.L    TAG_DONE
  316.     DC.L    GTIN_Number,0
  317.     DC.L    GTIN_MaxChars,10
  318.     DC.L    TAG_DONE
  319.     DC.L    GTIN_Number,0
  320.     DC.L    GTIN_MaxChars,10
  321.     DC.L    TAG_DONE
  322.     DC.L    GTST_MaxChars,256
  323.     DC.L    TAG_DONE
  324.     DC.L    GTST_MaxChars,256
  325.     DC.L    TAG_DONE
  326.     DC.L    GTST_MaxChars,256
  327.     DC.L    TAG_DONE
  328.     DC.L    GTST_MaxChars,256
  329.     DC.L    TAG_DONE
  330.     DC.L    TAG_DONE
  331.     DC.L    TAG_DONE
  332.     DC.L    TAG_DONE
  333.     DC.L    TAG_DONE
  334.     DC.L    TAG_DONE
  335.     DC.L    TAG_DONE
  336.     DC.L    TAG_DONE
  337.     DC.L    TAG_DONE
  338.     DC.L    TAG_DONE
  339.     DC.L    TAG_DONE
  340.     DC.L    TAG_DONE
  341.  
  342.  
  343. OKText:
  344.     DC.B    '_OK',0
  345.  
  346. CancelText:
  347.     DC.B    'Abbre_chen',0
  348.  
  349. SaveText:
  350.     DC.B    '_Sichern',0
  351.  
  352. Joystick1OnText:
  353.     DC.B    'Joystick an Port 1',0
  354.  
  355. Joystick2OnText:
  356.     DC.B    'Joystick an Port 2',0
  357.  
  358. JoystickSwapText:
  359.     DC.B    'Joysticks vertauschen',0
  360.  
  361. GetDisplayIDText:
  362.     DC.B    'Auswählen...',0
  363.  
  364. DisplayIDText:
  365.     DC.B    'Bildschirmmodus',0
  366.  
  367. ScreenTypeText:
  368.     DC.B    'Bildschirmtyp',0
  369.  
  370. NormalCyclesText:
  371.     DC.B    'Zyklen/Zeile (CPU)',0
  372.  
  373. BadLineCyclesText:
  374.     DC.B    'Zyklen/Bad Line (CPU)',0
  375.  
  376. CIACyclesText:
  377.     DC.B    'Zyklen/Zeile (CIA)',0
  378.  
  379. Dir8Text:
  380.     DC.B    'Laufwerk 8',0
  381.  
  382. Dir9Text:
  383.     DC.B    'Laufwerk 9',0
  384.  
  385. Dir10Text:
  386.     DC.B    'Laufwerk 10',0
  387.  
  388. Dir11Text:
  389.     DC.B    'Laufwerk 11',0
  390.  
  391. UseSIDCardText:
  392.     DC.B    'SID-Karte benutzen',0
  393.  
  394. Drv8IsIECText:
  395.     DC.B    'IEC',0
  396.  
  397. Drv9IsIECText:
  398.     DC.B    '',0
  399.  
  400. Drv10IsIECText:
  401.     DC.B    '',0
  402.  
  403. Drv11IsIECText:
  404.     DC.B    '',0
  405.  
  406. GetDir8Text:
  407.     DC.B    '',0
  408.  
  409. GetDir9Text:
  410.     DC.B    '',0
  411.  
  412. GetDir10Text:
  413.     DC.B    '',0
  414.  
  415. GetDir11Text:
  416.     DC.B    '',0
  417.  
  418. OtherIECText:
  419.     DC.B    'IEC für andere Geräte verwenden',0
  420.  
  421. KeyboardYZText:
  422.     DC.B    'Amerik. Tastatur',0
  423.  
  424.     CNOP    0,2
  425.  
  426.     XDEF    ScreenTypeLabels
  427.  
  428. ScreenTypeLabels:
  429.     DC.L    ScreenTypeLab0
  430.     DC.L    ScreenTypeLab1
  431.     DC.L    ScreenTypeLab2
  432.     DC.L    0
  433.  
  434. ScreenTypeLab0:    DC.B    'EGS',0
  435. ScreenTypeLab1:    DC.B    'Picasso',0
  436. ScreenTypeLab2:    DC.B    'Amiga',0
  437.  
  438.     CNOP    0,2
  439.  
  440.     XDEF    PrefsWindowTags
  441.  
  442. PrefsWindowTags:
  443. PrefsL:
  444.     DC.L    WA_Left,0
  445. PrefsT:
  446.     DC.L    WA_Top,0
  447. PrefsW:
  448.     DC.L    WA_Width,0
  449. PrefsH:
  450.     DC.L    WA_Height,0
  451.     DC.L    WA_IDCMP
  452.     dc.l    BUTTONIDCMP!CHECKBOXIDCMP!TEXTIDCMP!CYCLEIDCMP!INTEGERIDCMP!STRINGIDCMP!IDCMP_GADGETUP!IDCMP_VANILLAKEY!IDCMP_REFRESHWINDOW
  453.     DC.L    WA_Flags,WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_SMART_REFRESH!WFLG_SIMPLE_REFRESH!WFLG_ACTIVATE
  454. PrefsWG:
  455.     DC.L    WA_Gadgets,0
  456.     DC.L    WA_Title,PrefsWTitle
  457.     DC.L    WA_ScreenTitle,PrefsSTitle
  458.     DC.L    WA_AutoAdjust,1
  459.     DC.L    TAG_DONE
  460.  
  461. PrefsWTitle:
  462.     DC.B    'Frodo Einstellungen',0
  463.     CNOP    0,2
  464.  
  465. PrefsSTitle:
  466.     DC.B    'Frodo C64 Emulator V1.0 (C)1994-1995 Christian Bauer. Freely distributable.',0
  467.     CNOP    0,2
  468.  
  469. ComputeX:
  470.     move.l  d1,-(sp)
  471.     move.w  FontX,d1
  472.     bra.s   ComputeItX
  473. ComputeY:
  474.     move.l  d1,-(sp)
  475.     move.w  FontY,d1
  476.     mulu    d1,d0
  477.     addq.w  #4,d0
  478.     divu    #8,d0
  479.     move.l  (sp)+,d1
  480.     rts
  481.  
  482. ComputeItX:
  483.     mulu    d1,d0
  484.     addq.w  #4,d0
  485.     divu    #8,d0
  486.     move.l  (sp)+,d1
  487.     rts
  488.  
  489. ComputeFont:
  490.     lea.l   Attr,a0
  491.     move.l  a0,Font
  492.     move.l  Scr,a1
  493.     lea.l   sc_RastPort(a1),a1
  494.     move.l  rp_Font(a1),a1
  495.     move.l  LN_NAME(a1),ta_Name(a0)
  496.     move.w  tf_YSize(a1),ta_YSize(a0)
  497.     move.w  tf_XSize(a1),FontX
  498.     move.w  tf_YSize(a1),FontY
  499.     move.l  Scr,a0
  500.     move.b  sc_WBorLeft(a0),d0
  501.     ext.w   d0
  502.     move.w  d0,OffX
  503.     move.l  sc_Font(a0),a1
  504.     move.w  ta_YSize(a1),d0
  505.     addq.w  #1,d0
  506.     move.b  sc_WBorTop(a0),d1
  507.     ext.w   d1
  508.     add.w   d1,d0
  509.     move.w  d0,OffY
  510.     tst.w   d2
  511.     beq.s   CompDone
  512.     tst.w   d3
  513.     beq.s   CompDone
  514.     move.w  d2,d0
  515.     jsr     ComputeX
  516.     add.w   OffX,d0
  517.     move.b  sc_WBorRight(a0),d1
  518.     ext.w   d1
  519.     add.w   d1,d0
  520.     cmp.w   sc_Width(a0),d0
  521.     bhi.s   UseTopaz
  522.     move.w  d3,d0
  523.     jsr     ComputeY
  524.     add.w   OffY,d0
  525.     move.b  sc_WBorBottom(a0),d1
  526.     ext.w   d1
  527.     add.w   d1,d0
  528.     cmp.w   sc_Height(a0),d0
  529.     bhi.s   UseTopaz
  530. CompDone:
  531.     rts
  532. UseTopaz:
  533.     move.l  Font,a0
  534.     move.l  #TopazName,ta_Name(a0)
  535.     move.w  #8,FontY
  536.     move.w  #8,FontX
  537.     move.w  #8,ta_YSize(a0)
  538.     rts
  539.  
  540.     XDEF    SetupScreen
  541.  
  542. SetupScreen
  543.     movem.l d1-d3/a0-a2/a6,-(sp)
  544.     move.l  _IntuitionBase,a6
  545.     move.l  PubScreenName,a0
  546.     jsr     _LVOLockPubScreen(a6)
  547.     move.l  d0,Scr
  548.     tst.l   d0
  549.     beq     SError
  550.     moveq   #0,d2
  551.     moveq   #0,d3
  552.     jsr     ComputeFont
  553.     move.l  Scr,a0
  554.     move.l  _GadToolsBase,a6
  555.     lea.l   TD,a1
  556.     jsr     _LVOGetVisualInfoA(a6)
  557.     move.l  d0,VisualInfo
  558.     move.l  d0,CL+4
  559.     tst.l   d0
  560.     beq     VError
  561.     jsr     initGet
  562.     move.l  d0,getClass
  563.     tst.l   d0
  564.     beq     CError
  565.     move.l  _IntuitionBase,a6
  566.     move.l  d0,a0
  567.     suba.l  a1,a1
  568.     lea.l   CL,a2
  569.     jsr     _LVONewObjectA(a6)
  570.     move.l  d0,getImage
  571.     tst.l   d0
  572.     beq     OError
  573.     moveq   #0,d0
  574. SDone:
  575.     movem.l (sp)+,d1-d3/a0-a2/a6
  576.     rts
  577. SError:
  578.     moveq   #1,d0
  579.     bra.s   SDone
  580. VError:
  581.     moveq   #2,d0
  582.     bra.s   SDone
  583. CError:
  584.     moveq   #4,d0
  585.     bra.s   SDone
  586. OError:
  587.     moveq   #5,d0
  588.     bra.s   SDone
  589.  
  590.     XDEF    CloseDownScreen
  591.  
  592. CloseDownScreen:
  593.     movem.l d0-d1/a0-a1/a6,-(sp)
  594.     move.l  _IntuitionBase,a6
  595.     move.l  getImage,a0
  596.     cmpa.l  #0,a0
  597.     beq.s   NoObj
  598.     jsr     _LVODisposeObject(a6)
  599. NoObj:
  600.     move.l  getClass,a0
  601.     cmpa.l  #0,a0
  602.     beq.s   NoCls
  603.     jsr     _LVOFreeClass(a6)
  604. NoCls:
  605.     move.l  _GadToolsBase,a6
  606.     move.l  VisualInfo,a0
  607.     cmpa.l  #0,a0
  608.     beq.s   NoVis
  609.     jsr     _LVOFreeVisualInfo(a6)
  610.     move.l  #0,VisualInfo
  611. NoVis:
  612.     move.l  _IntuitionBase,a6
  613.     suba.l  a0,a0
  614.     move.l  Scr,a1
  615.     cmpa.l  #0,a1
  616.     beq.s   NoScr
  617.     jsr     _LVOUnlockPubScreen(a6)
  618.     move.l  #0,Scr
  619. NoScr:
  620.     movem.l (sp)+,d0-d1/a0-a1/a6
  621.     rts
  622.  
  623.     XDEF    OpenPrefsWindow
  624.  
  625. OpenPrefsWindow:
  626.     movem.l d1-d4/a0-a4/a6,-(sp)
  627.     move.l  Scr,a0
  628.     moveq   #0,d3
  629.     moveq   #0,d2
  630.     move.w  PrefsWidth,d2
  631.     move.w  PrefsHeight,d3
  632.     jsr     ComputeFont
  633.     move.l  Scr,a0
  634.     move.l  d2,d0
  635.     jsr     ComputeX
  636.     move.l  d0,d4
  637.     move.w  PrefsLeft,d2
  638.     add.w   d2,d0
  639.     add.w   OffX,d0
  640.     move.b  sc_WBorRight(a0),d1
  641.     ext.w   d1
  642.     add.w   d1,d0
  643.     cmp.w   sc_Width(a0),d0
  644.     bls.s   PrefsWOk
  645.     move.w  sc_Width(a0),d0
  646.     sub.w   d4,d0
  647.     move.w  d0,d2
  648. PrefsWOk:
  649.     move.l  d3,d0
  650.     jsr     ComputeY
  651.     move.l  d0,d4
  652.     move.w  PrefsTop,d3
  653.     add.w   d3,d0
  654.     add.w   OffY,d0
  655.     move.b  sc_WBorBottom(a0),d1
  656.     ext.w   d1
  657.     add.w   d1,d0
  658.     cmp.w   sc_Height(a0),d0
  659.     bls.s   PrefsHOk
  660.     move.w  sc_Height(a0),d0
  661.     sub.w   d4,d0
  662.     move.w  d0,d3
  663. PrefsHOk:
  664.     move.l  _GadToolsBase,a6
  665.     lea.l   PrefsGList,a0
  666.     jsr     _LVOCreateContext(a6)
  667.     move.l  d0,a3
  668.     tst.l   d0
  669.     beq     PrefsCError
  670.     movem.w d2-d3,-(sp)
  671.     moveq   #0,d3
  672.     lea.l   PrefsGTags,a4
  673. PrefsGL:
  674.     move.l  _SysBase,a6
  675.     lea.l   PrefsNGads,a0
  676.     move.l  d3,d0
  677.     mulu    #gng_SIZEOF,d0
  678.     add.l   d0,a0
  679.     lea.l   BufNewGad,a1
  680.     moveq   #gng_SIZEOF,d0
  681.     jsr     _LVOCopyMem(a6)
  682.     lea.l   BufNewGad,a0
  683.     move.l  VisualInfo,gng_VisualInfo(a0)
  684.     move.l  Font,gng_TextAttr(a0)
  685.     move.w  gng_LeftEdge(a0),d0
  686.     jsr     ComputeX
  687.     add.w   OffX,d0
  688.     move.w  d0,gng_LeftEdge(a0)
  689.     move.w  gng_TopEdge(a0),d0
  690.     jsr     ComputeY
  691.     add.w   OffY,d0
  692.     move.w  d0,gng_TopEdge(a0)
  693.     move.w  gng_Width(a0),d0
  694.     jsr     ComputeX
  695.     move.w  d0,gng_Width(a0)
  696.     move.w  gng_Height(a0),d0
  697.     jsr     ComputeY
  698.     move.w  d0,gng_Height(a0)
  699.     move.l  _GadToolsBase,a6
  700.     lea.l   PrefsGTypes,a0
  701.     moveq   #0,d0
  702.     move.l  d3,d1
  703.     asl.l   #1,d1
  704.     add.l   d1,a0
  705.     move.w  (a0),d0
  706.     move.l  a3,a0
  707.     lea.l   BufNewGad,a1
  708.     move.l  a4,a2
  709.     jsr     _LVOCreateGadgetA(a6)
  710.     tst.l   d0
  711.     bne.s    PrefsCOK
  712.     movem.w (sp)+,d2-d3
  713.     bra     PrefsGError
  714. PrefsCOK:
  715.     move.l  d0,a3
  716.     move.l  d3,d0
  717.     asl.l   #2,d0
  718.     lea.l   PrefsGadgets,a0
  719.     add.l   d0,a0
  720.     move.l  a3,(a0)
  721.     move.l  a3,a0
  722.     move.l  d3,d0
  723.     asl.l   #1,d0
  724.     lea.l   PrefsGTypes,a1
  725.     add.l   d0,a1
  726.     cmp.w   #GENERIC_KIND,(a1)
  727.     bne.s   PrefsNoGen1
  728.     or.w    #GFLG_GADGIMAGE!GFLG_GADGHIMAGE,gg_Flags(a0)
  729.     or.w    #GACT_RELVERIFY,gg_Activation(a0)
  730.     move.l  getImage,gg_GadgetRender(a0)
  731.     move.l  getImage,gg_SelectRender(a0)
  732. PrefsNoGen1:
  733. PrefsTL:
  734.     tst.l   (a4)
  735.     beq.s   PrefsDN
  736.     addq.w  #8,a4
  737.     bra.s   PrefsTL
  738. PrefsDN:
  739.     addq.w  #4,a4
  740.     addq.w  #1,d3
  741.     cmp.w   #Prefs_CNT,d3
  742.     bmi     PrefsGL
  743.     movem.w (sp)+,d2-d3
  744.     move.l  PrefsGList,PrefsWG+4
  745.     ext.l   d2
  746.     ext.l   d3
  747.     move.l  d2,PrefsL+4
  748.     move.l  d3,PrefsT+4
  749.     move.l  Scr,a0
  750.     move.w  PrefsWidth,d0
  751.     jsr     ComputeX
  752.     add.w   OffX,d0
  753.     move.b  sc_WBorRight(a0),d1
  754.     ext.w   d1
  755.     add.w   d1,d0
  756.     move.l  d0,PrefsW+4
  757.     move.w  PrefsHeight,d0
  758.     jsr     ComputeY
  759.     add.w   OffY,d0
  760.     move.b  sc_WBorBottom(a0),d1
  761.     ext.w   d1
  762.     add.w   d1,d0
  763.     move.l  d0,PrefsH+4
  764.     move.l  _IntuitionBase,a6
  765.     suba.l  a0,a0
  766.     lea.l   PrefsWindowTags,a1
  767.     jsr     _LVOOpenWindowTagList(a6)
  768.     move.l  d0,PrefsWnd
  769.     tst.l   d0
  770.     beq     PrefsWError
  771.     move.l  _GadToolsBase,a6
  772.     move.l  PrefsWnd,a0
  773.     suba.l  a1,a1
  774.     jsr     _LVOGT_RefreshWindow(a6)
  775.     moveq   #0,d0
  776. PrefsDone:
  777.     movem.l (sp)+,d1-d4/a0-a4/a6
  778.     rts
  779. PrefsCError:
  780.     moveq   #1,d0
  781.     bra.s   PrefsDone
  782. PrefsGError:
  783.     moveq   #2,d0
  784.     bra.s   PrefsDone
  785. PrefsWError:
  786.     moveq   #4,d0
  787.     bra.s   PrefsDone
  788.  
  789.     XDEF    ClosePrefsWindow
  790.  
  791. ClosePrefsWindow:
  792.     movem.l d0-d1/a0-a2/a6,-(sp)
  793.     move.l  _IntuitionBase,a6
  794.     move.l  PrefsWnd,a0
  795.     cmpa.l  #0,a0
  796.     beq     PrefsNWnd
  797.     jsr     _LVOCloseWindow(a6)
  798.     move.l  #0,PrefsWnd
  799. PrefsNWnd:
  800.     move.l  _GadToolsBase,a6
  801.     move.l  PrefsGList,a0
  802.     cmpa.l  #0,a0
  803.     beq     PrefsNGad
  804.     jsr     _LVOFreeGadgets(a6)
  805.     move.l  #0,PrefsGList
  806. PrefsNGad:
  807.     movem.l (sp)+,d0-d1/a0-a2/a6
  808.     rts
  809.  
  810.  
  811.     end
  812.